Skip to content

Manually link page next-prev across child borders #1985

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jul 24, 2025

Conversation

Kissaki
Copy link
Contributor

@Kissaki Kissaki commented Jul 16, 2025

The previous and next navigation links at the bottom of the page get filled automatically by vuepress, sourced from the (locale-specific) sidebar configuration.

We define the sidebar through sections - which may be single page sections or a section with child pages.

Previously, the website did not guide the user through our book.

  • Section prev always linked to previous section, never previous sections last child if available
  • Section next never linked to first child of section, if available
  • First child did not offer a prev link
  • Last child did not offer a next link

I did not see documentation about customizing the auto-discover behavior, nor the sidebar structure dependency of the automatic determination. But page frontmatter can override the prev and next links.

As a fixup, overriding the automatic discovery from the sidebar, we manually set the prev and next links on section child borders. The link text matches the headline/sidebar, and the links the sidebar structure. Given that this is manual configuration, there's a risk of it eventually being missed and becoming outdated or wrong when structure changes are made.

I did not test. I don't have a local nodejs env.

Resolves #1818

The previous and next navigation links at the bottom of the page get filled automatically by vuepress, sourced from the (locale-specific) sidebar configuration.

We define the sidebar through sections - which may be single page sections or a section with child pages.

Previously, the website did not guide the user through our book.

* Section prev always linked to previous section, never previous sections last child if available
* Section next never linked to first child of section, if available
* First child did not offer a prev link
* Last child did not offer a next link

I did not see documentation about customizing the auto-discover behavior, nor the sidebar structure dependency of the automatic determination.
But page frontmatter can override the prev and next links.

As a fixup, overriding the automatic discovery from the sidebar, we manually set the prev and next links on section child borders.
The link text matches the headline/sidebar, and the links the sidebar structure. Given that this is manual configuration, there's a risk of it eventually being missed and becoming outdated or wrong when structure changes are made.

I did not test. I don't have a local nodejs env.

Resolves nushell#1818

* https://v1.vuepress.vuejs.org/theme/default-theme-config.html#prev-next-links
* https://v1.vuepress.vuejs.org/guide/i18n.html#default-theme-i18n-config
* https://ecosystem.vuejs.press/themes/default/frontmatter.html#prev
@hustcer
Copy link
Contributor

hustcer commented Jul 22, 2025

Could you please update /book/README.md, /book/installation.md and /book/default_shell.md as well?

@hustcer hustcer merged commit 432945a into nushell:main Jul 24, 2025
2 checks passed
@Kissaki
Copy link
Contributor Author

Kissaki commented Jul 24, 2025

@hustcer Book looks fine to me with generated link though because it has no children!?

https://www.nushell.sh/book/ has a Next link to Installation.

I see that install has a default shell sub page. Seems like I missed that? I will take a look.

@Kissaki Kissaki deleted the prevnextlinks branch July 24, 2025 16:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Book navigation Next link skips chapter contents resulting in confusing navigation.
2 participants